<script setup>
import { ref, computed } from "vue"

const DateTime = ref('')

const result = computed(() => {
    const now = new Date(DateTime.value)
    return `${now.getFullYear()}年${now.getMonth() + 1}月${now.getDate()}日`
})

</script>

<template>
    <input v-model="DateTime" placeholder="输入日期（YYYY-MM-DD）" />
    <p>格式化日期：{{ result }}</p>
</template>